package cn.gjxblog.async;

import org.springframework.aop.framework.AopContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;


@Service
public class HelloServiceImpl  {

    @Autowired
            @Lazy
    HelloServiceImpl helloService;

    @Async
    public void play(){
        System.out.println("play当前线程：" + Thread.currentThread().getName());

        System.out.println(helloService);
        helloService.hello();
    }

     // 注意此处加上了此注解
    public Object hello() {
        System.out.println("hello当前线程：" + Thread.currentThread().getName());
        return null;

    }
}
